package com.jc.service.orderproduct;

import com.jc.cds.mapper.CustomOrderProductsMapper;
import com.jc.cds.mapper.CustomSupplierGoodsMapper;
import com.jc.ds.base.service.BaseServiceException;
import com.jc.framework.enums.Booleans;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import com.jc.cds.model.CustomOrderProducts;
import com.jc.ds.base.service.BaseServiceImpl;
import com.jc.ds.mapper.BaseCustomMapper;
import com.jc.ds.model.OrderProducts;

import java.util.ArrayList;
import java.util.List;


@Service
public class OrderProductsServiceImp extends BaseServiceImpl<OrderProducts, CustomOrderProducts, Long> implements OrderProductsService {

	@Override
	public CustomOrderProductsMapper getCustomMapper() {
		return (CustomOrderProductsMapper) this.getBaseCustomMapper();
	}

	@Override
	public List<OrderProducts> queryProductByOrderId(Long orderId){
		OrderProducts orderProducts = new OrderProducts();
		orderProducts.setOrderId(orderId);
		orderProducts.setIsGift(Booleans.FALSE.getName());
		orderProducts.setIsBind(0);
		orderProducts.setSubGoods(1);
		orderProducts.setIsDelete(Booleans.FALSE.getName());
		List<OrderProducts> orderProductsList = this.queryAll(orderProducts);
		return orderProductsList;
	}
	
	
	public void updateOrderProductExpressNo(String childOrderId,List<OrderProducts> prod){
		
		
	}

	@Override
	public List<OrderProducts> queryAllByIn(String ids) {
		if (StringUtils.isEmpty(ids)){
			throw new BaseServiceException("必传参数为空!");
		}
		List<OrderProducts> returnList = new ArrayList<>();
        String[] split = ids.split(",");
        for (String id:split) {
            returnList.add(this.queryById(Long.valueOf(id)));
        }
        return returnList;
    }

	@Override
	public List<OrderProducts> queryOrderProIdByOrderId(OrderProducts orderProducts) {
		return this.queryAll(orderProducts);
	}
}
